	package com.bussiness;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.dao.Contact;
import com.dao.ContactDAOImpl;
import com.opensymphony.xwork2.ActionSupport;

public class BussinessContactImpl extends ActionSupport implements BussinessContact{

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6021259894811039943L;

	
	
	
	

	private ContactDAOImpl linkController = null;

	public BussinessContactImpl() {
	linkController = new ContactDAOImpl();
	}
	
	
	



	public List<Contact> searchAction(String firstname,String lastname,boolean inActive,String order,int startPage,int endPage){
		return(linkController.listSearchContact(firstname,lastname,inActive,order,startPage,endPage));
	}
	
	public boolean editAction(Contact contact){
		//System.out.println(contact.getId());
		if(linkController.editDAO(contact)){
		return true;}
		else{
			return false;
		}
	}
	
	/*public String add() {
		
	try {
	linkController.add(getContact());
	}catch(Exception e) {
	e.printStackTrace();
	}
	return SUCCESS;
	}*/
	public boolean deleteAction(Long id) {
	if(linkController.deleteDAO(id)){
		return true;
	}else{
	return false;
	}}
	
	public Contact listEditContactAction(Long id){
		
		return(linkController.listEditContactDAO(id));
	}
	
	


	@Override
	public List<Contact> listAllContactAction() {
		// TODO Auto-generated method stub
	return(linkController.listAllDAO());
	}






	@Override
	public boolean addAction(Contact contact) {
		// TODO Auto-generated method stub
		if(linkController.addDAO(contact)){
			return true;}
			else{
				return false;
			}
	}


	

}
